# coding:utf-8
# 曾山
# 时间 2022/4/30 14:32

from flask_sqlalchemy import SQLAlchemy
class Config():
    HOSTNAME = '127.0.0.1'
    PORT = '3306'
    DATABASE = 'test3'
    USERNAME = 'root'
    PASSWORD = 'root'
    DB_URI = 'mysql+pymysql://{}:{}@{}:{}/{}?charset=utf8mb4'.format(USERNAME, PASSWORD, HOSTNAME, PORT, DATABASE)


    SQLALCHEMY_DATABASE_URI = DB_URI
    SQLALCHEMY_TRACK_MODIFICATIONS = False  # 不需要跟踪数据的修改

    LOGGING_LEVEL = 'DEBUG'#日志级别
    LOGGING_FILE_DIR = 'logs/'#日志目录
    LOGGING_FILE_MAX_BYTES = 300*1024*1024#最大日志文件大小
    LOGGING_FILE_BACKUP = 100#备份日志文件个数

    # 限流器采用Redis保存数据，默认是内存，需要安装flask-redis
    RATELIMIT_STORAGE_URL = 'redis://192.168.238.128:6379/0'
    # 限制策略：移动窗口：时间窗口会自动变化
    RATELIMIT_STRATEGY = 'moving-window'
    # redis数据库的连接地址,使用数据库1来存放缓存数据包括短信验证码
    REDIS_URL = "redis://192.168.238.128:6379/1"
class DevelopmentConfig(Config):
    DEBUG = True
    SQLALCHEMY_ECHO = True #打印sql语句

class PerductConfig(Config):
    pass

